package com.cskaoyan.javase.oop3._3inner._3loacl._4life;

/**
 *
 *
 * @since 14:27
 * @author wuguidong@cskaoyan.onaliyun.com
 */
public class Demo {
    public static void main(String[] args) {
        EnclosedClazz ec = new EnclosedClazz();
        IA ia = ec.test();
        ia.method();

    }
}

class EnclosedClazz {
    public IA test() {
        // a是test方法的局部变量
        int a = 10;
        class IAImpl implements IA {
            // int a = 10;
            @Override
            public void method() {
                System.out.println(a);
                // a = 100;
            }
        }

        return new IAImpl();
        // System.out.println(a); // 100
    }
}

interface IA {
    void method();
}